<html>
<head><meta charset="utf-8"><title>nested workspaces · t-cargo · Zulip Chat Archive</title></head>
<h2>Stream: <a href="https://rust-lang.github.io/zulip_archive/stream/246057-t-cargo/index.html">t-cargo</a></h2>
<h3>Topic: <a href="https://rust-lang.github.io/zulip_archive/stream/246057-t-cargo/topic/nested.20workspaces.html">nested workspaces</a></h3>

<hr>

<base href="https://rust-lang.zulipchat.com">

<head><link href="https://rust-lang.github.io/zulip_archive/style.css" rel="stylesheet"></head>

<a name="203612784"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/246057-t-cargo/topic/nested%20workspaces/near/203612784" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Brendan Cully <a href="https://rust-lang.github.io/zulip_archive/stream/246057-t-cargo/topic/nested.20workspaces.html#203612784">(Jul 11 2020 at 20:46)</a>:</h4>
<p>Hi all, I'm interested in nested workspaces for cargo and I see there's an issue for it <a href="https://github.com/rust-lang/cargo/issues/5042">https://github.com/rust-lang/cargo/issues/5042</a> but it looks like it's been stalled for a while. I wondered if anyone could help me understand whether it hasn't been implemented because there's some semantic subtlety to it, or more just because no one has gotten around to attempting it. I'm thinking about taking a stab at it but I'd like to not walk into some semantic dead end if I can avoid it :)</p>



<a name="203613015"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/246057-t-cargo/topic/nested%20workspaces/near/203613015" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/246057-t-cargo/topic/nested.20workspaces.html#203613015">(Jul 11 2020 at 20:54)</a>:</h4>
<p>We would <em>love</em> to have help implementing it.</p>



<a name="203613018"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/246057-t-cargo/topic/nested%20workspaces/near/203613018" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/246057-t-cargo/topic/nested.20workspaces.html#203613018">(Jul 11 2020 at 20:54)</a>:</h4>
<p>It's not that it's wildly subtle, it's more that it touches <em>so many things</em>.</p>



<a name="203613021"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/246057-t-cargo/topic/nested%20workspaces/near/203613021" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/246057-t-cargo/topic/nested.20workspaces.html#203613021">(Jul 11 2020 at 20:55)</a>:</h4>
<p>It does need some precise definition.</p>



<a name="203613085"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/246057-t-cargo/topic/nested%20workspaces/near/203613085" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Brendan Cully <a href="https://rust-lang.github.io/zulip_archive/stream/246057-t-cargo/topic/nested.20workspaces.html#203613085">(Jul 11 2020 at 20:56)</a>:</h4>
<p>I saw on the ticket things like parent workspaces reaching into grandchildren. I don't see a use case for that, seems like it would be easier to manage if each workspace could only include direct children, which themselves could be regular packages or workspaces.</p>



<a name="203613381"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/246057-t-cargo/topic/nested%20workspaces/near/203613381" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Brendan Cully <a href="https://rust-lang.github.io/zulip_archive/stream/246057-t-cargo/topic/nested.20workspaces.html#203613381">(Jul 11 2020 at 21:04)</a>:</h4>
<p>definition seems like a good starting point. The only point of reference I think I have for that is <a href="https://doc.rust-lang.org/cargo/reference/workspaces.html">https://doc.rust-lang.org/cargo/reference/workspaces.html</a> - is that right?</p>



<a name="203613382"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/246057-t-cargo/topic/nested%20workspaces/near/203613382" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Eric Huss <a href="https://rust-lang.github.io/zulip_archive/stream/246057-t-cargo/topic/nested.20workspaces.html#203613382">(Jul 11 2020 at 21:04)</a>:</h4>
<p>I think the "reaching into grandchildren" is the simple solution (just ignore intermediate workspace definitions).  For example, I would like for the rust repo to just add <code>src/tools/rust-analyzer/crates/rust-analyzer</code> and ignore the workspace definition at <code>src/tools/rust-analyzer</code>.   The basic need of nested workspaces is a shared Cargo.lock,  which is straightforward. Its all the other things that are tricky, like profiles, patches, metadata, etc.  I've been thinking about this a bit recently, but it is not clear how those should behave.  Ignore them?  Merge them?  Particularly for profiles, how should shared dependencies be handled when other members of the workspace are being built?  How would conflicts be resolved?</p>



<a name="203613414"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/246057-t-cargo/topic/nested%20workspaces/near/203613414" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Eric Huss <a href="https://rust-lang.github.io/zulip_archive/stream/246057-t-cargo/topic/nested.20workspaces.html#203613414">(Jul 11 2020 at 21:06)</a>:</h4>
<p>For reference there is also the original RFC that introduced the concept, though I am uncertain how out-of-date it is. <a href="https://rust-lang.github.io/rfcs/1525-cargo-workspace.html">https://rust-lang.github.io/rfcs/1525-cargo-workspace.html</a></p>



<a name="203613440"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/246057-t-cargo/topic/nested%20workspaces/near/203613440" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Brendan Cully <a href="https://rust-lang.github.io/zulip_archive/stream/246057-t-cargo/topic/nested.20workspaces.html#203613440">(Jul 11 2020 at 21:06)</a>:</h4>
<p>patches are in particular what I want them for :)</p>



<a name="203613444"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/246057-t-cargo/topic/nested%20workspaces/near/203613444" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Brendan Cully <a href="https://rust-lang.github.io/zulip_archive/stream/246057-t-cargo/topic/nested.20workspaces.html#203613444">(Jul 11 2020 at 21:06)</a>:</h4>
<p>ah thanks, I'll read that</p>



<a name="203613464"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/246057-t-cargo/topic/nested%20workspaces/near/203613464" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Eric Huss <a href="https://rust-lang.github.io/zulip_archive/stream/246057-t-cargo/topic/nested.20workspaces.html#203613464">(Jul 11 2020 at 21:07)</a>:</h4>
<p>I think for patches, it shouldn't be too hard to just merge them, just need to figure out what to do if there are conflicts.</p>



<a name="203613926"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/246057-t-cargo/topic/nested%20workspaces/near/203613926" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Brendan Cully <a href="https://rust-lang.github.io/zulip_archive/stream/246057-t-cargo/topic/nested.20workspaces.html#203613926">(Jul 11 2020 at 21:20)</a>:</h4>
<p>so there are I guess two problems, one is, for any given file in a project, to identify the root workspace, and two is how to merge the manifest information together for the target being built. The second problem sounds like it isn't specific to nested workspaces though? Don't we need a merge strategy even for one-level workspaces?</p>



<a name="203614207"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/246057-t-cargo/topic/nested%20workspaces/near/203614207" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Eric Huss <a href="https://rust-lang.github.io/zulip_archive/stream/246057-t-cargo/topic/nested.20workspaces.html#203614207">(Jul 11 2020 at 21:29)</a>:</h4>
<p>Profiles and patches in workspace members are ignored (they generate a warning IIRC).  </p>
<p>This issue has some other people talking about their use cases for nested profiles: <a href="https://github.com/rust-lang/cargo/issues/8264">https://github.com/rust-lang/cargo/issues/8264</a></p>



<hr><p>Last updated: Aug 07 2021 at 22:04 UTC</p>
</html>